package com.yizhi.student.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.yizhi.student.dao.StudentInfoDao;
import com.yizhi.student.domain.StudentInfoDO;
import com.yizhi.student.service.StudentInfoService;


@Service
public class StudentInfoServiceImpl implements StudentInfoService {


	@Autowired
	private StudentInfoDao studentInfoDao;

	@Override
	public StudentInfoDO get(Integer id) {
		System.out.println("======service层中传递过来的id参数是：" + id + "======");
		return studentInfoDao.get(id);
	}


	@Override
	public List<StudentInfoDO> list(Map<String, Object> map) {
		Object currPage = map.get("currPage");
		Object pageSize = map.get("pageSize");
		if (currPage != null && pageSize != null) {
			map.put("currPage", ((Integer.parseInt((String) currPage) - 1) * Integer.parseInt((String)pageSize)));
			map.put("pageSize", Integer.parseInt((String) pageSize));
		}
		return studentInfoDao.list(map);
	}

	//"===================================================================================="


	@Override
	public int count(Map<String, Object> map) {
		return studentInfoDao.count(map);
	}

	@Override
	public int save(StudentInfoDO studentInfo) {
		return studentInfoDao.save(studentInfo);
	}

	@Override
	public int update(StudentInfoDO studentInfo) {
		return studentInfoDao.update(studentInfo);
	}

	@Override
	public int remove(Integer id) {
		return studentInfoDao.remove(id);
	}

	@Override
	public int batchRemove(Integer[] ids) {
		return studentInfoDao.batchRemove(ids);
	}

}
